<template>
	<view class="module">
		<view class="back flex_c">
			<image src="../../static/icon/left_jt.png" mode="aspectFill" @click="goBack"></image>
			<text>权益规则</text>
		</view>
		<view >
			<rich-text class="quanyi" :nodes="nodeCentent"></rich-text>
		</view>
	</view>
</template>

<script>
	import {brandEquityIntroduction} from "../../api/store.js";
	export default {
		data() {
			return {
				brandAll:{},
				nodeCentent:'',
				titleStyle: {
					color: '#ffffff'
				},
			}
		},
		onLoad() {
			this.initDetail()
		},
		methods: {
			// 初始化
			initDetail() {
				brandEquityIntroduction({}).then(res => {
					console.log(11111,res);
					if (res.code == 1) {
						// this.brandAll = res.data
						var htmlContent = res.data.data
						const regex = new RegExp('<img', 'gi');
						htmlContent = htmlContent.replace(regex, `<img style="max-width: 100%;"`)
						this.nodeCentent = htmlContent;
					}
				})
			},
			goBack() {
				//获取页面栈的长度
				const canNavBack = getCurrentPages()
				console.log(canNavBack.length);
				// 判断是否刷新了浏览器，刷新了浏览器，页面栈只有当前一个
				if (canNavBack.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					uni.switchTab({
						url: '/pages/index/index'
					})
				}
			},
		},
	}
</script>

<style scoped>
	@font-face {
		font-family: 'iconfont';
		src: url("~@/iconfont/almm.ttf");
	}

	@font-face {
		font-family: 'iconfont2';
		src: url("~@/iconfont/YouSheBiaoTiHei.ttf");
	}
	.back {
		position: fixed;
		top: 30rpx;
		/* #ifdef APP */
		top: 60rpx;
		/* #endif */
		left: 20rpx;
		width: 100%;
		height: 88rpx;
		z-index: 999;
	}

	.back>text {
		/* #ifdef H5 */
		font-size: 28rpx;
		/* #endif */
		
		/* #ifdef APP */
		font-size: 32rpx;
		/* #endif */
		color: #ffffff;
	}

	.back>image {
		position: absolute;
		top: 50%;
		left: 0;
		transform: translateY(-50%);
		width: 60rpx;
		height: 60rpx;
	}
.module{
	position: relative;
	width: 750rpx;
	height: 100vh;
}
.module>image{
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
}
	
</style>